$(document).ready(function(){
    ajaxList();
});
$(".search").click(function () {
    var data = $("#searchform").serialize();
    ajaxList(data);
});

function ajaxList(data) {
    $.ajax({
        url: '/adopt/echartsColumn',
        data: data,
        type: 'POST',
        dataType: 'json',//返回的数据类型
        success: function (data) {
            columnPie(data.totalArray.time,data.totalArray.value);
            $(".stay").html(data.res.proposer_status1);
            $("#stay").html(data.res.proposer_status1_P+'%');

            $(".complete").html(data.res.proposer_status2);
            $("#complete").html(data.res.proposer_status2_P+'%');

            $(".cancel").html(data.res.proposer_status3);
            $("#cancel").html(data.res.proposer_status3_P+'%');

            $(".again").html(data.res.proposer_status4);
            $("#again").html(data.res.proposer_status4_P+'%');

            $(".release").html(data.res.total+'%');

        }
    })
}
function columnPie(dataX,dataY) {
    var myChart = echarts.init(document.getElementById('main'));
    option = {
        title: {
            text: '狗狗领养申请统计',
            x: 'center'
        },
        dataZoom: [
            {
                show: true,
            },
            {
                type: 'inside',
            },
            {
                show: true,
                yAxisIndex: 0,
                filterMode: 'empty',
                width: 30,
                height: '80%',
                showDataShadow: false,
                left: '93%'
            }
        ],
        xAxis: {
            type: 'category',
            data: dataX
        },
        yAxis: {
            type: 'value'
        },
        series: [{
            data: dataY,
            type: 'bar',
            itemStyle:{
                normal:{
                    color:'#FF9966'
                }
            },
        }]
    };
    myChart.setOption(option);
}

